{php include wl_template('common/header');}
<div class="page-group">
    <div class="page page-current" id="page-order-check">
    	<div class="content infinite-scroll" >
    		{if $is_hexiao_member}
	    	{if $result=='success'}
	    	<div class="msg">
			<div class="weui_msg">
			    <div class="weui_icon_area"><i class="weui_icon_success weui_icon_msg"></i></div>
			    <div class="weui_text_area">
			        <h2 class="weui_msg_title">核销成功</h2>
			        <p class="weui_msg_desc">点击确定，可返回微信</p>
			    </div>
			    <div class="weui_opr_area">
			        <p class="weui_btn_area">
			            <a id="closewindow" class="weui_btn weui_btn_primary">确定</a>
			        </p>
			    </div>
			</div>
			</div>
			{else}
			<div class="list-block cards-list" style="margin: 0;">
		      <ul>
		        <li class="card" style="border-radius: .2rem;">
		          <div class="card-header"><h3 class="font-size-14">到店自提核销凭证</h3></div>
		          <div class="card-content">
		            <div class="card-content-inner">

				        <div class="voucher-address font-size-14" style="margin-top:-10px;">
							<p>订单号：{$order['orderno']}</p>
							<p>团长：{if $order['tuan_first']==1}是{else}否{/if}</p>
				            <p>提货人：{$order['addname']}&nbsp; {$order['mobile']}</p>
				            <p>提货点：{$store['storename']}</p>
							<label>实际提货点：<select id= "actualAdress" name="actualAdress" style="display: inline;width: auto;height: 28px;" >
							<option value="">请点击选择核销门店</option>
								{loop $stores $item}
								<option value="{$item['id']}">{$item['storename']}</option>
								{/loop}
								
							</select>
				        </div>
							
				        <div class="voucher-goods-info font-size-14">
						
				            <p>项目名称：{$order['goodsname']} </p>
							{if !empty($order['optionname'])}<p>商品规格：{$order['optionname']} </p>{/if}
							<p>数量：{$order['gnum']}</p>
					        <p>实付金额：{$order['price']}元</p>
							{if $order['selltype']==7}
							<p>已补金额：{$master_order['price']}元</p>
					        {/if}
					        </div>
					    </div>
		          </div>
		        </li>
		      </ul>
		    </div>
		    <div class="weui_btn_area">
				{if $checkorder['status']==1}
				<a   class="weui_btn weui_btn_primary">本项目已核销，请勿重复核销</a>
				{else}
				<a id="conbdel"  class="weui_btn weui_btn_primary">确认核销</a>
				{/if}
	        	<a id="closewindow" class="weui_btn weui_btn_default">返回微信</a>
	    	</div>
			{/if}
		    {else}
	    	<div class="msg">
			<div class="weui_msg">
			    <div class="weui_icon_area"><i class="weui_icon_msg weui_icon_warn"></i></div>
			    <div class="weui_text_area">
			        <h2 class="weui_msg_title">非核销人员</h2>
			        <p class="weui_msg_desc">点击确定，可返回微信</p>
			    </div>
			    <div class="weui_opr_area">
			        <p class="weui_btn_area">
			            <a id="closewindow" class="weui_btn weui_btn_primary">确定</a>
			        </p>
			    </div>
			</div>
			</div>
			{/if}
    	</div>
	</div>
</div>
<script>
	$(document).on('click','#conbdel',function(){
		var id = document.getElementById("actualAdress").value;
		if (id == '') {
			$.toast("未选择实际门店地址");
			return;
		}
		$.confirm('此操作不可恢复，确认核销？',
	        function () {

	          	$.post("{php echo app_url('order/check',array('mid' => $orderno))}",{id:id},function(d){
				
					if(d.status == 1){
						location.href = "{php echo app_url('order/check',array('mid' => $orderno,'result' => 'success'))}";
					}else{
						$.toast(d.result);
					}
				},"json");
	        }
	    );
	});

	wx.ready(function(){
		$('#closewindow').click(function(){
			wx.closeWindow();
		});
	});
</script>
{php include wl_template('common/footer');}